package com.greet.utils;


import com.greet.dto.DishDTO;
import com.greet.dto.SetmealDTO;
import com.greet.entity.Dish;
import com.greet.entity.Setmeal;
import com.greet.vo.DishVO;
import com.greet.vo.SetmealVO;

public class PojoTypeTranformationUtil {
    public static Dish toDish(DishDTO dishDTO){
        return Dish.builder()
                .id(dishDTO.getId())
                .name(dishDTO.getName())
                .categoryId(dishDTO.getCategoryId())
                .price(dishDTO.getPrice())
                .image(dishDTO.getImage())
                .description(dishDTO.getDescription())
                .status(dishDTO.getStatus()).build();
    }

    public static Setmeal toSetmeal(SetmealDTO setmealDTO) {
        return Setmeal.builder()
                .id(setmealDTO.getId())
                .categoryId(setmealDTO.getCategoryId())
                .name(setmealDTO.getName())
                .price(setmealDTO.getPrice())
                .status(setmealDTO.getStatus())
                .description(setmealDTO.getDescription())
                .image(setmealDTO.getImage()).build();
    }

    public static SetmealVO toSetmealVO(Setmeal setmeal) {
        return SetmealVO.builder().id(setmeal.getId())
                .categoryId(setmeal.getCategoryId())
                .name(setmeal.getName())
                .price(setmeal.getPrice())
                .status(setmeal.getStatus())
                .description(setmeal.getDescription())
                .image(setmeal.getImage())
                .updateTime(setmeal.getUpdateTime())
                .build();
    }

    public static DishVO toDishVO(Dish dish) {
        DishVO dishVO = DishVO.builder()
                .id(dish.getId())
                .name(dish.getName())
                .categoryId(dish.getCategoryId())
                .price(dish.getPrice())
                .image(dish.getImage())
                .description(dish.getDescription())
                .status(dish.getStatus())
                .updateTime(dish.getUpdateTime()).build();
        return dishVO;
    }
}
